package com.lyz.dataStructure.JianZhiOffer.array;/**
 * @Author:759057893@qq.com Lyz
 * @Date: ${Date} 20:28
 * @Description:
 **/

import java.util.Scanner;

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/6/30 20:28
 *@Description:
 **/
public class Main2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.nextLine();
       String s =  sc.nextLine();
       String[] st = s.split(" ");

       int[] arr = new int[st.length];
       for(int i =0 ;i<s1.charAt(0);i++){
           arr[i] = Integer.parseInt(st[i]);
       }
        System.out.println(shu(arr));

    }

    public  static  int shu(int[] arr){
        Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int m = sc.nextInt();
       int count = 0 ;
       for(int i = 0;i<n;i++){
           if(arr[m-1]==0){
               return -1;
           }else if(arr[m-1]>0){
                count++;
           }
       }
       return count;
    }
}
